syn keyword fortranConditional if else elseif endif then
syn keyword fortranRepeat do
syn keyword fortranTodo contained TODO
syn region fortranString start=+"+ end=+"+ oneline
syn region fortranString start=+'+ end=+'+ oneline
" Format strings are used with READ, WRITE and PRINT
" READ and PRINT can be used without paretheses (and '(...)' is caught as '...' )
" FMTs can span several lines. This is not supoorted here for simple READ and PRINT
syn match fortranReadWrite "\<\(read\|print\)\>"
syn region fortranFormatString contained start=+'(+ end=+)'+ contains=fortranContinueLine
syn region fortranReadWriteFunc matchgroup=fortranReadWrite start="\(read\|write\)\s*("rs=e-1,he=e-1 skip=")'" matchgroup=NONE end=")" contains=fortranFormatString
" If you don't like initial tabs in fortran (or at all)
"syn match fortranIniTab "^\t.*$"
"syn match fortranTab "\t"
" This is valid with Gnu Fortran
"syn match fortranSpecial contained "\\\d\{3}\|\\."
"syn region fortranString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=fortranSpecial
"syn region fortranString start=+'+ skip=+\\\\\|\\"+ end=+'+ contains=fortranSpecial
" Any integer
syn match fortranNumber "-\=\<\d\+\>"
" floating point number, with dot, optional exponent
syn match fortranFloat "\<\d\+\.\d*\([edED][-+]\=\d\+\)\=\>"
" floating point number, starting with a dot, optional exponent
syn match fortranFloat "\.\d\+\([edED][-+]\=\d\+\)\=\>"
" floating point number, without dot, with exponent
syn match fortranFloat "\<\d\+[edED][-+]\=\d\+\>"
syn match fortranOperator "\.\(gt\|ge\|\lt\|\e\)\."
syn match fortranOperator "\.\(eq\|ne\|eqv\|neqv\)\."
syn match fortranOperator "\.\(and\|or\|not\)\."
syn match fortranLogicalConstant "\.\(true\|false\)\."
"syn match fortranIdentifier "\<[a-zA-Z_][a-zA-Z0-9_]*\>"
"syn match fortranDelimiter "[()]"
" any character other than a 'c' or '!' in the first column is an error
" (labelnumbers iare handled below, though)
syn match fortranCommentError "^\ \{,4}[^\ \t0-9].*$"
syn match fortranComment "^[cC*].*$" contains=fortranTodo,fortranTab
syn match fortranComment "!.*$" contains=fortranTodo,fortranTab
syn match fortranContinueLine "^\ \{5}\S"ms=e
syn match fortranNoLabelNumber "^\d\{5}\S.*$"
syn match fortranNoLabelNumber "^\ \d\{4}\S.*$"
syn match fortranNoLabelNumber "^\ \{2}\d\{3}\S.*$"
syn match fortranNoLabelNumber "^\ \{3}\d\{2}\S.*$"
syn match fortranNoLabelNumber "^\ \{4}\d\S.*$"
syn match fortranLabelNumber "^\d\{1,5}\>"
syn match fortranLabelNumber "^\ \d\{1,4}\>"
syn match fortranLabelNumber "^\ \{2}\d\{1,3}\>"
syn match fortranLabelNumber "^\ \{3}\d\{1,2}\>"
syn match fortranLabelNumber "^\ \{4}\d\>"
"syn match fortranPreCondit "^#define\>"
"syn match fortranPreCondit "^#include\>"
" Treat all past 72nd column as a comment. Do not work with tabs!
" Breaks down when 72-73rd column is in another match (eg number or keyword)
"syn match fortranComment "^.\{-72}.*$"lc=72
syn keyword fortranType character complex double implicit integer
syn keyword fortranType logical precision real real*8
syn keyword fortranStructure common dimension equivalence external
syn keyword fortranStructure intrinsic parameter save
syn keyword fortranUnitHeader call data end function program subroutine
" READ, WRITE and PRINT are handled above (as they take FMT arguments)
syn keyword fortranReadWrite backspace close inquire open rewind
syn keyword fortranFormat access blank err file fmt form format
syn keyword fortranFormat iostat rec recl status unit
syn keyword fortranStopPause stop pause
syn keyword fortranImplicit abs acos aint atan asin cos cosh aimag
syn keyword fortranImplicit anint atan2 char cmplx conjg dble dim
syn keyword fortranImplicit dprod exp ichar index int len lge lgt
syn keyword fortranImplicit lle llt log log10 max min mod nint sin
syn keyword fortranImplicit sinh sign sqrt tan tanh
syn keyword fortranSpecific cabs ccos cexp clog csin csqrt dabs
syn keyword fortranSpecific dacos dasin datan datan2 dcos dcosh
syn keyword fortranSpecific ddim dexp dint dlog dlog10 dmod
syn keyword fortranSpecific dnint dsign dsin dsinh dsqrt dtan
syn keyword fortranSpecific dtanh iabs idim idnint isign
" This syntax highlighting file support Fortran 77 by default
"syn keyword fortranExtended allocate assign block case contains cycle